﻿using System;
using System.Windows;
using jSLCore.Client.Presentation.BaseControl.Selection;
using Telerik.Windows.Controls;

namespace jSLCore.Client.Presentation.Wpf.TelerikSupport.Selection
{
    /// <summary>
    /// Interaction logic for SingleSelectColumn.xaml
    /// </summary>
    public partial class SingleSelectColumn : GridViewColumn
    {
        public SingleSelectColumn()
        {
            InitializeComponent();
        }

        private void column_Clicked(object sender, RoutedEventArgs e)
        {
            var element = sender as FrameworkElement;
            if (element != null) InvokeRowSelected(element.DataContext);
        }

        public event EventHandler<RowSelectedEventArgs> RowSelected;
        public void InvokeRowSelected(object row)
        {
            EventHandler<RowSelectedEventArgs> handler = RowSelected;
            if (handler != null) handler(this, new RowSelectedEventArgs(row));
        }
    }
}
